package com.hgw.Demo11_VisitorPattern.examples;

import java.util.ArrayList;

/**
 * Data time:2021/12/21 20:39
 * StudentID:2019112118
 * Author:hgw
 * Description: 员工列表类，充当对象结构
 */
public class EmployeeList {
    // 定义一个集合用于存储员工对象
    private ArrayList<Employee> list = new ArrayList<Employee>();

    public void addEmployee(Employee employee) {
        list.add(employee);
    }

    // 遍历访问员工集合中的每一个员工对象
    public void accept(Department handler) {
        for (Employee employee : list) {
            employee.accept(handler);
        }
    }
}
